package com.company.test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class FilterTest2 {
  public static void main(String[] args) {
    List<Person> list = new ArrayList<>();
    list.add(new Person("tom", 8900, 23, "male", "New York"));
    list.add(new Person("Jack", 7000, 25, "male", "Washington"));
    list.add(new Person("Lily", 7800, 21, "female", "Washington"));
    list.add(new Person("Anni", 8200, 24, "female", "New York"));
    list.add(new Person("Owen", 9500, 25, "male", "New York"));
    list.add(new Person("Alisa", 7900, 26, "female", "New York"));
    List<String> nameList =
        list.stream()
            .filter(x -> x.getSalary() > 8000)
            .map(Person::getName)
            .collect(Collectors.toList());
    System.out.println("工资高于8000"+nameList);
  }
}
